﻿namespace JanusLibAing.AutoSave
{
    public abstract class DataItemString : IDataItem
    {
        private string stringValue;

        /// <summary>
        /// Initializes a new instance of the <see cref="DataItemString"/> class.
        /// </summary>
        /// <param name="value">The value.</param>
        protected DataItemString(string value)
        {
            stringValue = value;
        }

        /// <summary>
        /// Returns a <see cref="System.String"/> that represents this instance.
        /// </summary>
        /// <returns>
        /// A <see cref="System.String"/> that represents this instance.
        /// </returns>
        public override string ToString()
        {
            return ItemValue;
        }

        public void ParseValue(string importValue)
        {
            stringValue = importValue;
        }

        /// <summary>
        /// Gets the item name.
        /// </summary>
        /// <value>The name.</value>
        public abstract string Name { get; }

        /// <summary>
        /// Gets or sets the value.
        /// </summary>
        /// <value>The value.</value>
        public object Value
        {
            get { return stringValue; }
            set { stringValue = (string) value; }
        }

        /// <summary>
        /// Gets or sets the item value.
        /// </summary>
        /// <value>The item value.</value>
        public string ItemValue
        {
            get { return stringValue; }
            set { stringValue = value; }
        }
    }
}